<template>
  <a-modal
    title="逾期列表"
    :width="850"
    :visible="visible"
    :confirmLoading="loading"
    @ok="
      () => {
        $emit('ok')
      }
    "
    @cancel="
      () => {
        $emit('cancel')
      }
    "
    :footer="null"
  >
    <a-spin :spinning="loading">
      <AWM-overdue :rdata="rdata" :visible="visible" :type="type"></AWM-overdue>
      <!-- <s-table ref="table" size="default" rowKey="id" :columns="columns" :data="loadData" showPagination="auto">
        <span slot="status" slot-scope="text,scope">
          <a-tag color="green" v-if="scope.taskJson.flow_finish_id == 1">已完成</a-tag>
          <a-tag color="blue" v-else>进行中</a-tag>
        </span>
        
        <span slot="userNames" slot-scope="text">
          <a-tag color="blue" v-for="(it,index) in text" :key="index">{{it}}</a-tag>
        </span>
      </s-table> -->
    </a-spin>
  </a-modal>
</template>

<script>
import pick from 'lodash.pick'
import { STable } from '@/components'
import { overdueTaskListStatistics } from '@/api/system'
import AWMOverdue from '@/views/components/overdue'
// 表单字段
const fields = ['id']
const columns = [
  // {
  //   title: '项目ID',
  //   dataIndex: 'projectId',
  // },
  {
    title: '项目',
    dataIndex: 'projectName',
  },
  {
    title: '工作室',
    dataIndex: 'studioName',
  },
  {
    title: '类型',
    width: 80,
    dataIndex: 'module',
    customRender: (text) => text == 'asset' ? '资产' : '镜头',
  },
  {
    title: '信息名称',
    dataIndex: 'cn_name',
    customRender: (text,scope) => scope.infoJson ? scope.infoJson.entity : '--',
  },
  {
    title: '任务',
    dataIndex: 'action',
    customRender: (text,scope) => scope.taskJson ? scope.taskJson.entity : '--',
  },
  {
    title: '制作者',
    width: 100,
    dataIndex: 'userNames',
    scopedSlots: { customRender: 'userNames' },
    // customRender: (text,scope) => scope.taskJson ? scope.taskJson.userNames : '--',
  },
   {
    title: '状态',
    dataIndex: 'status',
    scopedSlots: { customRender: 'status' },
  },
]
export default {
  props: {
    visible: {
      type: Boolean,
      required: true,
    },
    rdata: {
      type: Object,
      required: {},
    },
    type: {
      type: String,
      default: '1',
    },
  },
  components: {
    STable,
    AWMOverdue
  },
  data() {
    this.columns = columns
    return {
      loading: false,
      parameter: {
        pageNum: 1,
        pageSize: 10,
      },
      queryParam: {},
      init: true,
      // loadData: (parameter) => {
      //   this.loading = true
      //   // studioId
      //   // projectId
      //   const requestParameters = Object.assign({}, this.parameter, this.queryParam)
      //   // this.data,
      //   if (this.type == '1') {
      //     requestParameters['studioId'] = this.data.id
      //   } else if (this.type == '2') {
      //     requestParameters['projectId'] = this.data.id
      //   }
      //   // requestParameters.type = 1
      //   console.log(requestParameters)
      //   return overdueTaskListStatistics(requestParameters).then((res) => {
      //     this.init = false
      //     this.loading = false
      //     let result = {
      //       data: res.data.data.map(v=>{
      //         v.taskJson = v.taskJson ? JSON.parse(v.taskJson) : {}
      //         v.infoJson = v.infoJson ? JSON.parse(v.infoJson) : {}
      //         return v
      //       }),
      //       pageNo: parameter.pageNo,
      //       pageSize: parameter.pageSize,
      //       totalCount: res.data.total,
      //       totalPage: res.data.pages,
      //     }
      //     return result
      //   })
      // },
    }
  },
  created() {},
  methods: {
    // handleJump(scope) {
    //   this.$emit('jump', scope)
    // },
  },
  watch: {
    // visible: function (n, o) {
    //   if (n) {
    //     if (!this.init) {
    //       this.$refs.table.refresh()
    //     }
    //   }
    // },
  },
}
</script>
<style lang="less" scoped>
.jumpName {
  cursor: pointer;
}
</style>